﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.Command;
using Register.DALFactory;
using Register.IDAL;
using Register.Model;
namespace Register.BLL
{
    /// <summary> 
    /// FileName: DoctorPersonInfoBLL.cs    
    /// CLRVersion: 4.0.30319.269    
    /// Author: DoubleZ    
    /// Corporation:     
    /// Description:     
    /// DateTime: 2012/7/7 11:01:05    
    /// </summary>
  public  class DoctorPersonInfoBLL
  {
      private static String typeNameKey = "IDoctorPersonInfoDALKey";
#region 获取医生用户信息
      public static List<DoctorUserInfo> GetDoctorUserInfo(string doctorUserID) {
          try
          {
              IDoctorPersonInfoDAL iParamter = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);

              return iParamter.GetDoctorUserInfo(doctorUserID);
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
#endregion
      #region 获取医生信息
      public static List<DoctorInfo> GetDoctorInfo(string doctorID)
      {
          try
          {
              IDoctorPersonInfoDAL iParamter = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);

              return iParamter.GetDoctorInfo(doctorID);
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      #endregion
      #region 编辑医生个人信息
      /// <summary>
      /// 编辑医生用户信息
      /// </summary>
      /// <param name="doctorUserInfo"></param>
      /// <returns></returns>
      public static bool UpdateDoctorUserInfo(DoctorUserInfo doctorUserInfo) {
         IDoctorPersonInfoDAL iDoctorUserInfo = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);
          try
          {
              if (iDoctorUserInfo.UpdateDoctorUserInfo(doctorUserInfo)> 0)
              {
                  return true;
              }
              else
                  return false;
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      /// <summary>
      /// 编辑医生信息
      /// </summary>
      /// <param name="doctorInfo"></param>
      /// <returns></returns>
      public static  bool UpdateDoctorInfo(DoctorInfo doctorInfo) {
          IDoctorPersonInfoDAL iDoctorInfo = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);
          try
          {
              if (iDoctorInfo.UpdateDoctorInfo(doctorInfo) > 0)
              {
                  return true;
              }
              else
                  return false;
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }

      #endregion
      #region 获取患者评价信息
      public static List<Model.EvaluationInfo> GetPagedEvaluationInfo(int size, int pageIndex, string where)
      {
          IDoctorPersonInfoDAL iEvaluation = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);
          try
          {
              return iEvaluation.GetPagedEvaluationInfo(size,pageIndex,where) ;
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      public static int GetEvaluationInfoCount(string where)
      {
          IDoctorPersonInfoDAL iEvaluationInfo = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);

          try
          {
              return iEvaluationInfo.GetEvaluationInfoCount(where);
          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      #endregion
      #region 根据患者ID获取患者姓名
      public static string GetPatientNameById(string patientID)
      {
          IDoctorPersonInfoDAL ipatientInfo = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);
          try
          {
              return ipatientInfo.GetPatientNameById(patientID);

          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      #endregion
      #region 根据评价ID获取评价详情
      public static string GetEvaluateContentById(string evaluateID)
      {
          IDoctorPersonInfoDAL ipatientInfo = DALFactory<IDoctorPersonInfoDAL>.Create(typeNameKey);
          try
          {
              return ipatientInfo.GetEvaluationInfoById(evaluateID);

          }
          catch (Exception e)
          {
              LogRecordHelper.LogNote("ERROR", e.Message);
              throw e;
          }
      }
      #endregion
  }
}
